#!/bin/bash

ip=192.168.0.49
username=citms
password=123456

rm -rf *.image
rm -rf *.html

for i in "$@"
do
    p=`echo "${i}"|awk -F / '{print $3;}'|awk -F : '{print $1;}'`
    c=`echo "${i}"|awk -F / '{print $2;}'`
    q=`echo "${i}"|awk -F : '{print $3;}'`
    echo "${i} ${c} ${p} ${q}"
    docker pull ${i}
    docker save ${i} > ${c}_${p}_${q}.image
    gzip ${c}_${p}_${q}.image
done

echo $(sshpass -p "$password"  scp *.gz  $username@$ip:E:\scan_docker_images)
sshpass -p "$password"  ssh $username@$ip "kaspersky.bat"

rm -rf *.gz
